<?php
/*
 * this is used in preference to file.php due to a bug that prevents files downloaded via that method being 
 * reported as corrupted by iTunes (attempts to modify the header information and use read_file_chunks()
 * did help to identify the cause of the bug).
 */
require_once("../../config.php");
require_once('../../lib/filelib.php');


$path  = $CFG->dataroot . get_file_argument('mp3.php');
$fsp   = split('/', $path);
$fname = $fsp[sizeof($fsp)-1];

header("Cache-Control: public, must-revalidate");
header("Pragma: "); 
header("Content-Type: application/octet-stream");
header("Content-Length: " .(string)(filesize($path)) );
header('Content-Disposition: attachment; filename="' . $fname . '"');
header("Content-Transfer-Encoding: binary\n");

readfile($path);

?>
